sseg segment stack
DB 256 DUP (?)
sseg ends

dseg segment
msg1 DB '3-as variantas',10,10,13,'$'
msg2 DB 'Ivesk simboliu eilute:',10,13,'$'
msg3 DB 'didziasias i mazasias:',10,13,'$'

eilute DB 81, 82 DUP (?)
dseg ends

cseg segment
	assume SS:sseg, DS:dseg, CS:cseg;
start proc far

mov AX, dseg
mov DS, AX

lea DX, msg1
mov ah, 09h
int 21h

lea DX, msg2
mov ah, 09h
int 21h

skaito:
	mov ah, 01h	
	int 21h
	
	cmp al, 13
	je galas	
	
	jmp saugot

saugot:
	mov eilute[bx], al
	inc BX
	jmp skaito
	
galas:
	mov eilute[bx], byte ptr 10
	mov eilute[bx+1], byte ptr 13
	mov eilute[bx+2], byte ptr '$'
	jmp rodo

rodo:
	lea DX, eilute
	mov ah, 09h
	int 21h
	
	lea DX, msg3
	mov ah, 09h
	int 21h	


lea BX, eilute

ciklas:
	mov DL, [BX]
	inc BX
	cmp DL, '$'
	je quit
	
	cmp DL, 65
	jge didesnis
	
	mov ah, 06
	int 21h

	jmp ciklas

jmp quit

didesnis:
	cmp DL, 90
	jle didinti
	
	mov ah, 06
	int 21h

	jmp ciklas

didinti:
	add DX, 32
	mov ah, 06
	int 21h

	jmp ciklas

quit:
	mov ah, 0Ah
	int 21h

	mov ah, 4ch
	mov al, 0
	int 21h

start endp
cseg ends
end start